# syntax=docker/dockerfile:1

FROM golang:1.19 AS builder

WORKDIR /ddns

COPY . ./
RUN go env -w GO111MODULE=on
RUN go env -w GOPROXY=https://mirrors.tencent.com/go/

RUN go mod download

RUN go build -tags netgo -o ddns main.go

FROM alpine:latest

COPY --from=builder /ddns/ddns /opt/
COPY --from=builder /ddns/config /opt/config

WORKDIR /opt

CMD ["./ddns"]
